#coding=utf-8
'''
Created on 2017-04-27

@author: sandy
'''

from pycommon import BaseCountmanager
import Center
import CenterBuild
import ClientFactory

class CounterManager(BaseCountmanager.BaseCounterManager):
    
    def __init__(self):
        BaseCountmanager.BaseCounterManager.__init__(self)
        
    def onTimer(self):
        BaseCountmanager.BaseCounterManager.onTimer(self)
        m = self.getCounterMap()
        self.clear()
        if len(m) > 0:
            Center.instance.sendPacket(CenterBuild.reportCounter(m))

        online = ClientFactory.instance.getOnlineUserCount()
        Center.instance.sendPacket(CenterBuild.reportOnlineCounter(online))
           
    
instance = CounterManager()

if __name__ == '__main__':
    pass